using System;

namespace Game.Network {
    public static class Client {
        private static TCPClient m_tcpClient = null;
        private static UDPClient m_udpClient = null;

        public static TCPClient TCP { get { return m_tcpClient; } }

        public static UDPClient UDP{ get { return m_udpClient; } }

        public static void TCPConnect (string hostname, int port) {
            if (m_udpClient != null)
                m_udpClient.Dispose ();
            if (m_tcpClient != null)
                m_tcpClient.Dispose ();

            m_tcpClient = new TCPClient (hostname, port);
            m_udpClient = null;
        }

        public static void UDPConnect (string hostname, int port, int tps) {
            m_udpClient = new UDPClient (hostname, port, tps);
        }

        public static void UDPConnect (string hostname, int port) {
            m_udpClient = new UDPClient (hostname, port);
        }

        public static void ProcessNetwork () {
            m_tcpClient.ProcessQueue ();
            m_udpClient.ProcessQueue ();
        }
    }
}

